﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;
using System.Collections.Generic;//Please add references
namespace ZG_member.DAL
{
    /// <summary>
    /// 数据访问类:memberInfo
    /// </summary>
    public partial class memberInfo
    {
        public memberInfo()
        { }
        #region  Method

        /// <summary>
        /// 得到最大ID
        /// </summary>
        public int GetMaxId()
        {
            return DbHelperSQL.GetMaxID("id", "memberInfo");
        }
        public string GetMaxmemberId()
        {
            return DbHelperSQL.GetMaxmemberId("memberId", "memberInfo");
        }

        public string Getheji(string top,string where)
        {
            return DbHelperSQL.Getheji(top, where);
        }

        /// <summary>
        /// 根据memberCardID得到实体
        /// </summary>
        public ZG_member.Model.memberInfo GetModeCard(string id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,memberId,memberCardId,memberName,sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher,picUrl from memberInfo ");
            strSql.Append(" where memberCardId=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.VarChar,20)
};
            parameters[0].Value = id;

            ZG_member.Model.memberInfo model = new ZG_member.Model.memberInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memberId"] != null && ds.Tables[0].Rows[0]["memberId"].ToString() != "")
                {
                    model.memberId = ds.Tables[0].Rows[0]["memberId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberCardId"] != null && ds.Tables[0].Rows[0]["memberCardId"].ToString() != "")
                {
                    model.memberCardId = ds.Tables[0].Rows[0]["memberCardId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberName"] != null && ds.Tables[0].Rows[0]["memberName"].ToString() != "")
                {
                    model.memberName = ds.Tables[0].Rows[0]["memberName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sex"] != null && ds.Tables[0].Rows[0]["sex"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["sex"].ToString() == "1") || (ds.Tables[0].Rows[0]["sex"].ToString().ToLower() == "true"))
                    {
                        model.sex = true;
                    }
                    else
                    {
                        model.sex = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["mobile"] != null && ds.Tables[0].Rows[0]["mobile"].ToString() != "")
                {
                    model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IDNumber"] != null && ds.Tables[0].Rows[0]["IDNumber"].ToString() != "")
                {
                    model.IDNumber = ds.Tables[0].Rows[0]["IDNumber"].ToString();
                }
                if (ds.Tables[0].Rows[0]["birthDay"] != null && ds.Tables[0].Rows[0]["birthDay"].ToString() != "")
                {
                    model.birthDay = DateTime.Parse(ds.Tables[0].Rows[0]["birthDay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["cardType"] != null && ds.Tables[0].Rows[0]["cardType"].ToString() != "")
                {
                    model.cardType = int.Parse(ds.Tables[0].Rows[0]["cardType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Balance"] != null && ds.Tables[0].Rows[0]["Balance"].ToString() != "")
                {
                    model.Balance = decimal.Parse(ds.Tables[0].Rows[0]["Balance"].ToString());
                }
                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
                {
                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["createDate"] != null && ds.Tables[0].Rows[0]["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["expiresDate"] != null && ds.Tables[0].Rows[0]["expiresDate"].ToString() != "")
                {
                    model.expiresDate = DateTime.Parse(ds.Tables[0].Rows[0]["expiresDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["consume"] != null && ds.Tables[0].Rows[0]["consume"].ToString() != "")
                {
                    model.consume = decimal.Parse(ds.Tables[0].Rows[0]["consume"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memo"] != null && ds.Tables[0].Rows[0]["memo"].ToString() != "")
                {
                    model.memo = ds.Tables[0].Rows[0]["memo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["pwd"] != null && ds.Tables[0].Rows[0]["pwd"].ToString() != "")
                {
                    model.pwd = ds.Tables[0].Rows[0]["pwd"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Marriage"] != null && ds.Tables[0].Rows[0]["Marriage"].ToString() != "")
                {
                    model.Marriage = ds.Tables[0].Rows[0]["Marriage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Zip"] != null && ds.Tables[0].Rows[0]["Zip"].ToString() != "")
                {
                    model.Zip = ds.Tables[0].Rows[0]["Zip"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MemberType"] != null && ds.Tables[0].Rows[0]["MemberType"].ToString() != "")
                {
                    model.MemberType = ds.Tables[0].Rows[0]["MemberType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AreasID"] != null && ds.Tables[0].Rows[0]["AreasID"].ToString() != "")
                {
                    model.AreasID = Convert.ToInt32(ds.Tables[0].Rows[0]["AreasID"]);
                }


                //*****
                if (ds.Tables[0].Rows[0]["Profession"] != null && ds.Tables[0].Rows[0]["Profession"].ToString() != "")
                {
                    model.Profession = ds.Tables[0].Rows[0]["Profession"].ToString();
                }
                if (ds.Tables[0].Rows[0]["hobby"] != null && ds.Tables[0].Rows[0]["hobby"].ToString() != "")
                {
                    model.hobby = ds.Tables[0].Rows[0]["hobby"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }
     

                if (ds.Tables[0].Rows[0]["Child"] != null && ds.Tables[0].Rows[0]["Child"].ToString() != "")
                {
                    model.Child = ds.Tables[0].Rows[0]["Child"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Unit"] != null && ds.Tables[0].Rows[0]["Unit"].ToString() != "")
                {
                    model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OpenTeacher"] != null && ds.Tables[0].Rows[0]["OpenTeacher"].ToString() != "")
                {
                    model.OpenTeacher = ds.Tables[0].Rows[0]["OpenTeacher"].ToString();
                }
                if (ds.Tables[0].Rows[0]["picUrl"] != null && ds.Tables[0].Rows[0]["picUrl"].ToString() != "")
                {
                    model.picUrl = ds.Tables[0].Rows[0]["picUrl"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        public ZG_member.Model.memberInfo GetModelFormemberCardId(string id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,memberId,memberCardId,memberName,sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher from memberInfo ");
            strSql.Append(" where memberId=@memberId");
            SqlParameter[] parameters = {
					new SqlParameter("@memberId", SqlDbType.NVarChar,50)
};
            parameters[0].Value = id;

            ZG_member.Model.memberInfo model = new ZG_member.Model.memberInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memberId"] != null && ds.Tables[0].Rows[0]["memberId"].ToString() != "")
                {
                    model.memberId = ds.Tables[0].Rows[0]["memberId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberCardId"] != null && ds.Tables[0].Rows[0]["memberCardId"].ToString() != "")
                {
                    model.memberCardId = ds.Tables[0].Rows[0]["memberCardId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberName"] != null && ds.Tables[0].Rows[0]["memberName"].ToString() != "")
                {
                    model.memberName = ds.Tables[0].Rows[0]["memberName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sex"] != null && ds.Tables[0].Rows[0]["sex"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["sex"].ToString() == "1") || (ds.Tables[0].Rows[0]["sex"].ToString().ToLower() == "true"))
                    {
                        model.sex = true;
                    }
                    else
                    {
                        model.sex = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["mobile"] != null && ds.Tables[0].Rows[0]["mobile"].ToString() != "")
                {
                    model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IDNumber"] != null && ds.Tables[0].Rows[0]["IDNumber"].ToString() != "")
                {
                    model.IDNumber = ds.Tables[0].Rows[0]["IDNumber"].ToString();
                }
                if (ds.Tables[0].Rows[0]["birthDay"] != null && ds.Tables[0].Rows[0]["birthDay"].ToString() != "")
                {
                    model.birthDay = DateTime.Parse(ds.Tables[0].Rows[0]["birthDay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["cardType"] != null && ds.Tables[0].Rows[0]["cardType"].ToString() != "")
                {
                    model.cardType = int.Parse(ds.Tables[0].Rows[0]["cardType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Balance"] != null && ds.Tables[0].Rows[0]["Balance"].ToString() != "")
                {
                    model.Balance = decimal.Parse(ds.Tables[0].Rows[0]["Balance"].ToString());
                }
                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
                {
                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["createDate"] != null && ds.Tables[0].Rows[0]["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["expiresDate"] != null && ds.Tables[0].Rows[0]["expiresDate"].ToString() != "")
                {
                    model.expiresDate = DateTime.Parse(ds.Tables[0].Rows[0]["expiresDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["consume"] != null && ds.Tables[0].Rows[0]["consume"].ToString() != "")
                {
                    model.consume = decimal.Parse(ds.Tables[0].Rows[0]["consume"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memo"] != null && ds.Tables[0].Rows[0]["memo"].ToString() != "")
                {
                    model.memo = ds.Tables[0].Rows[0]["memo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["pwd"] != null && ds.Tables[0].Rows[0]["pwd"].ToString() != "")
                {
                    model.pwd = ds.Tables[0].Rows[0]["pwd"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Marriage"] != null && ds.Tables[0].Rows[0]["Marriage"].ToString() != "")
                {
                    model.Marriage = ds.Tables[0].Rows[0]["Marriage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Zip"] != null && ds.Tables[0].Rows[0]["Zip"].ToString() != "")
                {
                    model.Zip = ds.Tables[0].Rows[0]["Zip"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MemberType"] != null && ds.Tables[0].Rows[0]["MemberType"].ToString() != "")
                {
                    model.MemberType = ds.Tables[0].Rows[0]["MemberType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AreasID"] != null && ds.Tables[0].Rows[0]["AreasID"].ToString() != "")
                {
                    model.AreasID = Convert.ToInt32(ds.Tables[0].Rows[0]["AreasID"]);
                }

                //*****
                if (ds.Tables[0].Rows[0]["Profession"] != null && ds.Tables[0].Rows[0]["Profession"].ToString() != "")
                {
                    model.Profession = ds.Tables[0].Rows[0]["Profession"].ToString();
                }
                if (ds.Tables[0].Rows[0]["hobby"] != null && ds.Tables[0].Rows[0]["hobby"].ToString() != "")
                {
                    model.hobby = ds.Tables[0].Rows[0]["hobby"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }

                if (ds.Tables[0].Rows[0]["Child"] != null && ds.Tables[0].Rows[0]["Child"].ToString() != "")
                {
                    model.Child = ds.Tables[0].Rows[0]["Child"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Unit"] != null && ds.Tables[0].Rows[0]["Unit"].ToString() != "")
                {
                    model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OpenTeacher"] != null && ds.Tables[0].Rows[0]["OpenTeacher"].ToString() != "")
                {
                    model.OpenTeacher = ds.Tables[0].Rows[0]["OpenTeacher"].ToString();
                }


                return model;
            }
            else
            {
                return null;
            }
        }
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string memberId, string memberCardId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from memberInfo");
            strSql.Append(" where memberId=@memberId  and  memberCardId = @memberCardId");
            SqlParameter[] parameters = {
					new SqlParameter("@memberId", SqlDbType.NVarChar,50),
                    new SqlParameter("@memberCardId", SqlDbType.NVarChar,50)
};
            parameters[0].Value = memberId;
            parameters[1].Value = memberCardId;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }
        public bool Existsbyphone(string mobile,string memberid)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from memberInfo");
            strSql.Append(" where Tel=@mobile and memberid != @memberid");
            SqlParameter[] parameters = {
					new SqlParameter("@mobile", SqlDbType.NVarChar,50),
                    new SqlParameter("@memberid", SqlDbType.NVarChar,50)

};
            parameters[0].Value = mobile;
            parameters[1].Value = memberid;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ZG_member.Model.memberInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into memberInfo(");
            strSql.Append("memberId,memberCardId,memberName,sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher,picUrl)");
            strSql.Append(" values (");
            strSql.Append("@memberId,@memberCardId,@memberName,@sex,@mobile,@Tel,@Email,@IDNumber,@birthDay,@cardType,@Balance,@point,@status,@createDate,@expiresDate,@consume,@memo,@pwd,@Marriage,@Zip,@Address,@AreasID,@MemberType,@Profession,@hobby,@QQ,@Child,@Unit,@OpenTeacher,@picUrl)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@memberId", SqlDbType.NVarChar,50),
					new SqlParameter("@memberCardId", SqlDbType.NVarChar,50),
					new SqlParameter("@memberName", SqlDbType.NVarChar,20),
					new SqlParameter("@sex", SqlDbType.Bit,1),
					new SqlParameter("@mobile", SqlDbType.NVarChar,20),
					new SqlParameter("@Tel", SqlDbType.NVarChar,20),
					new SqlParameter("@Email", SqlDbType.NVarChar,50),
					new SqlParameter("@IDNumber", SqlDbType.NVarChar,20),
					new SqlParameter("@birthDay", SqlDbType.Date,3),
					new SqlParameter("@cardType", SqlDbType.Int,4),
					new SqlParameter("@Balance", SqlDbType.Money,8),
					new SqlParameter("@point", SqlDbType.Int,4),
					new SqlParameter("@status", SqlDbType.Int,4),
					new SqlParameter("@createDate", SqlDbType.Date,3),
					new SqlParameter("@expiresDate", SqlDbType.Date,3),
					new SqlParameter("@consume", SqlDbType.Money,8),
					new SqlParameter("@memo", SqlDbType.NVarChar,200),
                    new SqlParameter("@pwd", SqlDbType.NVarChar,40),
                    new SqlParameter("@Marriage", SqlDbType.NVarChar,40),
                    new SqlParameter("@Zip", SqlDbType.NVarChar,40),
                    new SqlParameter("@Address", SqlDbType.NVarChar,40),
                    new SqlParameter("@AreasID", SqlDbType.Int,4),
                    new SqlParameter("@MemberType",SqlDbType.NVarChar,20),
                    new SqlParameter("@Profession", SqlDbType.NVarChar,50),
                    new SqlParameter("@hobby", SqlDbType.NVarChar,50),
                    new SqlParameter("@QQ", SqlDbType.NVarChar,50),
                    new SqlParameter("@Child", SqlDbType.NVarChar,50),
                    new SqlParameter("@Unit", SqlDbType.NVarChar,50),
                    new SqlParameter("@OpenTeacher", SqlDbType.NVarChar,50),
                    new SqlParameter("@picUrl",SqlDbType.NVarChar,50)
                                        };
            parameters[0].Value = model.memberId;
            parameters[1].Value = model.memberCardId;
            parameters[2].Value = model.memberName;
            parameters[3].Value = model.sex;
            parameters[4].Value = model.mobile;
            parameters[5].Value = model.Tel;
            parameters[6].Value = model.Email;
            parameters[7].Value = model.IDNumber;
            parameters[8].Value = model.birthDay;
            parameters[9].Value = model.cardType;
            parameters[10].Value = model.Balance;
            parameters[11].Value = model.point;
            parameters[12].Value = model.status;
            parameters[13].Value = model.createDate;
            parameters[14].Value = model.expiresDate;
            parameters[15].Value = model.consume;
            parameters[16].Value = model.memo;
            parameters[17].Value = model.pwd;
            parameters[18].Value = model.Marriage;
            parameters[19].Value = model.Zip;
            parameters[20].Value = model.Address;
            parameters[21].Value = model.AreasID;
            parameters[22].Value = model.MemberType;
            //parameters[23].Value = model.Semester;
            //parameters[24].Value = model.Course;
            parameters[23].Value = model.Profession;
            parameters[24].Value = model.hobby;
            parameters[25].Value = model.QQ;
            //parameters[28].Value = model.Demand;
            //parameters[29].Value = model.Cost;
            //parameters[30].Value = model.InterestCourse;
            parameters[26].Value = model.Child;
            parameters[27].Value = model.Unit;
            parameters[28].Value = model.OpenTeacher;
            parameters[29].Value = model.picUrl;
            //parameters[34].Value = model.CourseConsultant;
            //parameters[35].Value = model.FavoriteTeacher;
            //parameters[36].Value = model.CourseNum;
            //parameters[37].Value = model.CountCourseNum;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ZG_member.Model.memberInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update memberInfo set ");
            strSql.Append("memberId=@memberId,");
            strSql.Append("memberCardId=@memberCardId,");
            strSql.Append("memberName=@memberName,");
            strSql.Append("sex=@sex,");
            strSql.Append("mobile=@mobile,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Email=@Email,");
            strSql.Append("IDNumber=@IDNumber,");
            strSql.Append("birthDay=@birthDay,");
            strSql.Append("cardType=@cardType,");
            strSql.Append("Balance=@Balance,");
            strSql.Append("point=@point,");
            strSql.Append("status=@status,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("expiresDate=@expiresDate,");
            strSql.Append("consume=@consume,");
            strSql.Append("memo=@memo,");
            strSql.Append("pwd=@pwd,");
            strSql.Append("Marriage=@Marriage,");
            strSql.Append("Zip=@Zip,");
            strSql.Append("Address=@Address,");
            strSql.Append("AreasID=@AreasID,");
            strSql.Append("MemberType=@MemberType,");
            strSql.Append("Profession=@Profession,");
            strSql.Append("hobby=@hobby,");
            strSql.Append("QQ=@QQ,");
            strSql.Append("Child=@Child,");
            strSql.Append("Unit=@Unit,");
            strSql.Append("OpenTeacher=@OpenTeacher,");
            strSql.Append("picUrl=@picUrl");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@memberId", SqlDbType.NVarChar,50),
					new SqlParameter("@memberCardId", SqlDbType.NVarChar,50),
					new SqlParameter("@memberName", SqlDbType.NVarChar,20),
					new SqlParameter("@sex", SqlDbType.Bit,1),
					new SqlParameter("@mobile", SqlDbType.NVarChar,20),
					new SqlParameter("@Tel", SqlDbType.NVarChar,20),
					new SqlParameter("@Email", SqlDbType.NVarChar,50),
					new SqlParameter("@IDNumber", SqlDbType.NVarChar,20),
					new SqlParameter("@birthDay", SqlDbType.Date,3),
					new SqlParameter("@cardType", SqlDbType.Int,4),
					new SqlParameter("@Balance", SqlDbType.Money,8),
					new SqlParameter("@point", SqlDbType.Int,4),
					new SqlParameter("@status", SqlDbType.Int,4),
					new SqlParameter("@createDate", SqlDbType.Date,3),
					new SqlParameter("@expiresDate", SqlDbType.Date,3),
					new SqlParameter("@consume", SqlDbType.Money,8),
					new SqlParameter("@memo", SqlDbType.NVarChar,200),
                    new SqlParameter("@pwd", SqlDbType.NVarChar,40),
                    new SqlParameter("@Marriage", SqlDbType.NVarChar,40),
                    new SqlParameter("@Zip", SqlDbType.NVarChar,40),
                    new SqlParameter("@Address", SqlDbType.NVarChar,40),
                    new SqlParameter("@AreasID", SqlDbType.Int,4),
                    new SqlParameter("@MemberType", SqlDbType.NVarChar,20),
                    new SqlParameter("@Profession",SqlDbType.NVarChar,200),
                    new SqlParameter("@hobby",SqlDbType.NVarChar,200),
                    new SqlParameter("@QQ",SqlDbType.NVarChar,200),
                   
                    new SqlParameter("@Child",SqlDbType.NVarChar,200),
                    new SqlParameter("@Unit",SqlDbType.NVarChar,200),
                    new SqlParameter("@OpenTeacher",SqlDbType.NVarChar,200),
                    new SqlParameter("@picUrl",SqlDbType.NVarChar,200),
					new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = model.memberId;
            parameters[1].Value = model.memberCardId;
            parameters[2].Value = model.memberName;
            parameters[3].Value = model.sex;
            parameters[4].Value = model.mobile;
            parameters[5].Value = model.Tel;
            parameters[6].Value = model.Email;
            parameters[7].Value = model.IDNumber;
            parameters[8].Value = model.birthDay;
            parameters[9].Value = model.cardType;
            parameters[10].Value = model.Balance;
            parameters[11].Value = model.point;
            parameters[12].Value = model.status;
            parameters[13].Value = model.createDate;
            parameters[14].Value = model.expiresDate;
            parameters[15].Value = model.consume;
            parameters[16].Value = model.memo;
            parameters[17].Value = model.pwd;
            parameters[18].Value = model.Marriage;
            parameters[19].Value = model.Zip;
            parameters[20].Value = model.Address;
            parameters[21].Value = model.AreasID;
            parameters[22].Value = model.MemberType;
            //parameters[23].Value = model.Semester;
            //parameters[24].Value = model.Course;
            parameters[23].Value = model.Profession;
            parameters[24].Value = model.hobby;
            parameters[25].Value = model.QQ;
            //parameters[28].Value = model.Demand;
            //parameters[29].Value = model.Cost;
            //parameters[30].Value = model.InterestCourse;
            parameters[26].Value = model.Child;
            parameters[27].Value = model.Unit;
            parameters[28].Value = model.OpenTeacher;
            parameters[29].Value = model.picUrl;
            //parameters[34].Value = model.CourseConsultant;
            //parameters[35].Value = model.FavoriteTeacher;
            //parameters[36].Value = model.CourseNum;
            //parameters[37].Value = model.CountCourseNum;
            parameters[30].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public bool Update1(ZG_member.Model.memberInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update memberInfo set ");
            strSql.Append("point=@point");
            SqlParameter[] parameters = {					
					new SqlParameter("@point", SqlDbType.Int,4)};
            parameters[0].Value = model.point;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool Updatepoint(ZG_member.Model.memberInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update memberInfo set ");
            strSql.Append("point=@point where memberid = @memberid");
            SqlParameter[] parameters = {					
					new SqlParameter("@point", SqlDbType.Int,4),
                                        new SqlParameter("@memberid", SqlDbType.NVarChar,200)};
            parameters[0].Value = model.point;
            parameters[1].Value = model.memberId;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        public bool Update2(ZG_member.Model.memberInfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update memberInfo set ");
            strSql.Append("pwd=@pwd");
            SqlParameter[] parameters = {					
					new SqlParameter("@pwd", SqlDbType.NVarChar,40)};
            parameters[0].Value = model.pwd;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public bool Update3(string status,string memberId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update memberInfo set ");
            strSql.Append("status=@status ");
            strSql.Append("where memberId =@memberId ");
            SqlParameter[] parameters = {					
					new SqlParameter("@status", SqlDbType.Int,4),
                     new SqlParameter("@memberId", SqlDbType.NVarChar,50)};
            parameters[0].Value = status;
            parameters[1].Value = memberId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        public bool jifenUpdate(string point, string consume, string memberId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update memberInfo set ");
            strSql.Append("point=@point ");
            strSql.Append("consume=@consume ");
            strSql.Append("where memberId =@memberId ");
            SqlParameter[] parameters = {					
					new SqlParameter("@point", SqlDbType.NVarChar,50),
                    new SqlParameter("@consume", SqlDbType.NVarChar,50),
                     new SqlParameter("@memberId", SqlDbType.NVarChar,50)};
            parameters[0].Value = point;
            parameters[1].Value = consume;
            parameters[2].Value = memberId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool shifoushouxinUpdate(string shifoushouxin, string memberId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update memberInfo set ");
            strSql.Append("shifouhuixing=@shifouhuixing ");
            strSql.Append("where memberId =@memberId ");
            SqlParameter[] parameters = {					
                    new SqlParameter("@shifouhuixing", SqlDbType.NVarChar,50),
                     new SqlParameter("@memberId", SqlDbType.NVarChar,50)};
            parameters[0].Value = shifoushouxin;
            parameters[1].Value = memberId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from memberInfo ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
};
            parameters[0].Value = id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from memberInfo ");
            strSql.Append(" where id in (" + idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        //修改会员封装实体
        //        public ZG_member.Model.memberInfo GetModels(int id)
        //        {
        //            StringBuilder strSql = new StringBuilder();
        //            strSql.Append("select  top 1 id,memberId,memberCardId,memberName,sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,status,createDate,expiresDate,consume,memo,pwd from memberInfo ");
        //            strSql.Append(" where id=@id");
        //            SqlParameter[] parameters = {
        //                    new SqlParameter("@id", SqlDbType.Int,4)
        //};
        //            parameters[0].Value = id;

        //            ZG_member.Model.memberInfo model = new ZG_member.Model.memberInfo();
        //            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
        //            if (ds.Tables[0].Rows.Count > 0)
        //            {
        //                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
        //                {
        //                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["memberId"] != null && ds.Tables[0].Rows[0]["memberId"].ToString() != "")
        //                {
        //                    model.memberId = ds.Tables[0].Rows[0]["memberId"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["memberCardId"] != null && ds.Tables[0].Rows[0]["memberCardId"].ToString() != "")
        //                {
        //                    model.memberCardId = ds.Tables[0].Rows[0]["memberCardId"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["memberName"] != null && ds.Tables[0].Rows[0]["memberName"].ToString() != "")
        //                {
        //                    model.memberName = ds.Tables[0].Rows[0]["memberName"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["sex"] != null && ds.Tables[0].Rows[0]["sex"].ToString() != "")
        //                {
        //                    if ((ds.Tables[0].Rows[0]["sex"].ToString() == "1") || (ds.Tables[0].Rows[0]["sex"].ToString().ToLower() == "true"))
        //                    {
        //                        model.sex = true;
        //                    }
        //                    else
        //                    {
        //                        model.sex = false;
        //                    }
        //                }
        //                if (ds.Tables[0].Rows[0]["mobile"] != null && ds.Tables[0].Rows[0]["mobile"].ToString() != "")
        //                {
        //                    model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
        //                {
        //                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
        //                {
        //                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["IDNumber"] != null && ds.Tables[0].Rows[0]["IDNumber"].ToString() != "")
        //                {
        //                    model.IDNumber = ds.Tables[0].Rows[0]["IDNumber"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["birthDay"] != null && ds.Tables[0].Rows[0]["birthDay"].ToString() != "")
        //                {
        //                    model.birthDay = DateTime.Parse(ds.Tables[0].Rows[0]["birthDay"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["cardType"] != null && ds.Tables[0].Rows[0]["cardType"].ToString() != "")
        //                {
        //                    model.cardType = int.Parse(ds.Tables[0].Rows[0]["cardType"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["Balance"] != null && ds.Tables[0].Rows[0]["Balance"].ToString() != "")
        //                {
        //                    model.Balance = decimal.Parse(ds.Tables[0].Rows[0]["Balance"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
        //                {
        //                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
        //                {
        //                    model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["createDate"] != null && ds.Tables[0].Rows[0]["createDate"].ToString() != "")
        //                {
        //                    model.createDate = DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["expiresDate"] != null && ds.Tables[0].Rows[0]["expiresDate"].ToString() != "")
        //                {
        //                    model.expiresDate = DateTime.Parse(ds.Tables[0].Rows[0]["expiresDate"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["consume"] != null && ds.Tables[0].Rows[0]["consume"].ToString() != "")
        //                {
        //                    model.consume = decimal.Parse(ds.Tables[0].Rows[0]["consume"].ToString());
        //                }
        //                if (ds.Tables[0].Rows[0]["memo"] != null && ds.Tables[0].Rows[0]["memo"].ToString() != "")
        //                {
        //                    model.memo = ds.Tables[0].Rows[0]["memo"].ToString();
        //                }
        //                if (ds.Tables[0].Rows[0]["pwd"] != null && ds.Tables[0].Rows[0]["pwd"].ToString() != "")
        //                {
        //                    model.pwd = ds.Tables[0].Rows[0]["pwd"].ToString();
        //                }
        //                return model;
        //            }
        //            else
        //            {
        //                return null;
        //            }
        //        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ZG_member.Model.memberInfo GetModel(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,memberId,memberCardId,memberName,sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher,picUrl from memberInfo ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
};
            parameters[0].Value = id;

            ZG_member.Model.memberInfo model = new ZG_member.Model.memberInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memberId"] != null && ds.Tables[0].Rows[0]["memberId"].ToString() != "")
                {
                    model.memberId = ds.Tables[0].Rows[0]["memberId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberCardId"] != null)
                {
                    model.memberCardId = ds.Tables[0].Rows[0]["memberCardId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberName"] != null && ds.Tables[0].Rows[0]["memberName"].ToString() != "")
                {
                    model.memberName = ds.Tables[0].Rows[0]["memberName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sex"] != null && ds.Tables[0].Rows[0]["sex"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["sex"].ToString() == "1") || (ds.Tables[0].Rows[0]["sex"].ToString().ToLower() == "true"))
                    {
                        model.sex = true;
                    }
                    else
                    {
                        model.sex = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["mobile"] != null && ds.Tables[0].Rows[0]["mobile"].ToString() != "")
                {
                    model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IDNumber"] != null && ds.Tables[0].Rows[0]["IDNumber"].ToString() != "")
                {
                    model.IDNumber = ds.Tables[0].Rows[0]["IDNumber"].ToString();
                }
                if (ds.Tables[0].Rows[0]["birthDay"] != null && ds.Tables[0].Rows[0]["birthDay"].ToString() != "")
                {
                    model.birthDay = DateTime.Parse(ds.Tables[0].Rows[0]["birthDay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["cardType"] != null && ds.Tables[0].Rows[0]["cardType"].ToString() != "")
                {
                    model.cardType = int.Parse(ds.Tables[0].Rows[0]["cardType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Balance"] != null && ds.Tables[0].Rows[0]["Balance"].ToString() != "")
                {
                    model.Balance = decimal.Parse(ds.Tables[0].Rows[0]["Balance"].ToString());
                }
                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
                {
                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["createDate"] != null && ds.Tables[0].Rows[0]["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["expiresDate"] != null && ds.Tables[0].Rows[0]["expiresDate"].ToString() != "")
                {
                    model.expiresDate = DateTime.Parse(ds.Tables[0].Rows[0]["expiresDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["consume"] != null && ds.Tables[0].Rows[0]["consume"].ToString() != "")
                {
                    model.consume = decimal.Parse(ds.Tables[0].Rows[0]["consume"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memo"] != null && ds.Tables[0].Rows[0]["memo"].ToString() != "")
                {
                    model.memo = ds.Tables[0].Rows[0]["memo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["pwd"] != null && ds.Tables[0].Rows[0]["pwd"].ToString() != "")
                {
                    model.pwd = ds.Tables[0].Rows[0]["pwd"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Marriage"] != null && ds.Tables[0].Rows[0]["Marriage"].ToString() != "")
                {
                    model.Marriage = ds.Tables[0].Rows[0]["Marriage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Zip"] != null && ds.Tables[0].Rows[0]["Zip"].ToString() != "")
                {
                    model.Zip = ds.Tables[0].Rows[0]["Zip"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MemberType"] != null && ds.Tables[0].Rows[0]["MemberType"].ToString() != "")
                {
                    model.MemberType = ds.Tables[0].Rows[0]["MemberType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AreasID"] != null && ds.Tables[0].Rows[0]["AreasID"].ToString() != "")
                {
                    model.AreasID = Convert.ToInt32(ds.Tables[0].Rows[0]["AreasID"]);
                }
                //*****
                if (ds.Tables[0].Rows[0]["Profession"] != null && ds.Tables[0].Rows[0]["Profession"].ToString() != "")
                {
                    model.Profession = ds.Tables[0].Rows[0]["Profession"].ToString();
                }
                if (ds.Tables[0].Rows[0]["hobby"] != null && ds.Tables[0].Rows[0]["hobby"].ToString() != "")
                {
                    model.hobby = ds.Tables[0].Rows[0]["hobby"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }

                if (ds.Tables[0].Rows[0]["Child"] != null && ds.Tables[0].Rows[0]["Child"].ToString() != "")
                {
                    model.Child = ds.Tables[0].Rows[0]["Child"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Unit"] != null && ds.Tables[0].Rows[0]["Unit"].ToString() != "")
                {
                    model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OpenTeacher"] != null && ds.Tables[0].Rows[0]["OpenTeacher"].ToString() != "")
                {
                    model.OpenTeacher = ds.Tables[0].Rows[0]["OpenTeacher"].ToString();
                }
                if (ds.Tables[0].Rows[0]["picUrl"] != null && ds.Tables[0].Rows[0]["picUrl"].ToString() != "")
                {
                    model.picUrl = ds.Tables[0].Rows[0]["picUrl"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 根据会员卡号得到实体对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ZG_member.Model.memberInfo GetUserIdMode(string id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from memberInfo ");
            strSql.Append(" where memberCardId=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id",id)
};
            //parameters[0].Value = id;

            ZG_member.Model.memberInfo model = new ZG_member.Model.memberInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memberId"] != null && ds.Tables[0].Rows[0]["memberId"].ToString() != "")
                {
                    model.memberId = ds.Tables[0].Rows[0]["memberId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberCardId"] != null && ds.Tables[0].Rows[0]["memberCardId"].ToString() != "")
                {
                    model.memberCardId = ds.Tables[0].Rows[0]["memberCardId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberName"] != null && ds.Tables[0].Rows[0]["memberName"].ToString() != "")
                {
                    model.memberName = ds.Tables[0].Rows[0]["memberName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sex"] != null && ds.Tables[0].Rows[0]["sex"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["sex"].ToString() == "1") || (ds.Tables[0].Rows[0]["sex"].ToString().ToLower() == "true"))
                    {
                        model.sex = true;
                    }
                    else
                    {
                        model.sex = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["mobile"] != null && ds.Tables[0].Rows[0]["mobile"].ToString() != "")
                {
                    model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IDNumber"] != null && ds.Tables[0].Rows[0]["IDNumber"].ToString() != "")
                {
                    model.IDNumber = ds.Tables[0].Rows[0]["IDNumber"].ToString();
                }
                if (ds.Tables[0].Rows[0]["birthDay"] != null && ds.Tables[0].Rows[0]["birthDay"].ToString() != "")
                {
                    model.birthDay = DateTime.Parse(ds.Tables[0].Rows[0]["birthDay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["cardType"] != null && ds.Tables[0].Rows[0]["cardType"].ToString() != "")
                {
                    model.cardType = int.Parse(ds.Tables[0].Rows[0]["cardType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Balance"] != null && ds.Tables[0].Rows[0]["Balance"].ToString() != "")
                {
                    model.Balance = decimal.Parse(ds.Tables[0].Rows[0]["Balance"].ToString());
                }
                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
                {
                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["createDate"] != null && ds.Tables[0].Rows[0]["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["expiresDate"] != null && ds.Tables[0].Rows[0]["expiresDate"].ToString() != "")
                {
                    model.expiresDate = DateTime.Parse(ds.Tables[0].Rows[0]["expiresDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["consume"] != null && ds.Tables[0].Rows[0]["consume"].ToString() != "")
                {
                    model.consume = decimal.Parse(ds.Tables[0].Rows[0]["consume"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memo"] != null && ds.Tables[0].Rows[0]["memo"].ToString() != "")
                {
                    model.memo = ds.Tables[0].Rows[0]["memo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["pwd"] != null && ds.Tables[0].Rows[0]["pwd"].ToString() != "")
                {
                    model.pwd = ds.Tables[0].Rows[0]["pwd"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Marriage"] != null && ds.Tables[0].Rows[0]["Marriage"].ToString() != "")
                {
                    model.Marriage = ds.Tables[0].Rows[0]["Marriage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Zip"] != null && ds.Tables[0].Rows[0]["Zip"].ToString() != "")
                {
                    model.Zip = ds.Tables[0].Rows[0]["Zip"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MemberType"] != null && ds.Tables[0].Rows[0]["MemberType"].ToString() != "")
                {
                    model.MemberType = ds.Tables[0].Rows[0]["MemberType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AreasID"] != null && ds.Tables[0].Rows[0]["AreasID"].ToString() != "")
                {
                    model.AreasID = Convert.ToInt32(ds.Tables[0].Rows[0]["AreasID"]);
                }
          
                //*****
                if (ds.Tables[0].Rows[0]["Profession"] != null && ds.Tables[0].Rows[0]["Profession"].ToString() != "")
                {
                    model.Profession = ds.Tables[0].Rows[0]["Profession"].ToString();
                }
                if (ds.Tables[0].Rows[0]["hobby"] != null && ds.Tables[0].Rows[0]["hobby"].ToString() != "")
                {
                    model.hobby = ds.Tables[0].Rows[0]["hobby"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Child"] != null && ds.Tables[0].Rows[0]["Child"].ToString() != "")
                {
                    model.Child = ds.Tables[0].Rows[0]["Child"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Unit"] != null && ds.Tables[0].Rows[0]["Unit"].ToString() != "")
                {
                    model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OpenTeacher"] != null && ds.Tables[0].Rows[0]["OpenTeacher"].ToString() != "")
                {
                    model.OpenTeacher = ds.Tables[0].Rows[0]["OpenTeacher"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 根据会员编号得到实体对象
        /// </summary>

        public ZG_member.Model.memberInfo GetModels(string id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from memberInfo ");
            strSql.Append(" where memberId=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id",id)
};
            //parameters[0].Value = id;

            ZG_member.Model.memberInfo model = new ZG_member.Model.memberInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memberId"] != null && ds.Tables[0].Rows[0]["memberId"].ToString() != "")
                {
                    model.memberId = ds.Tables[0].Rows[0]["memberId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberCardId"] != null )
                {
                    model.memberCardId = ds.Tables[0].Rows[0]["memberCardId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["memberName"] != null && ds.Tables[0].Rows[0]["memberName"].ToString() != "")
                {
                    model.memberName = ds.Tables[0].Rows[0]["memberName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sex"] != null && ds.Tables[0].Rows[0]["sex"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["sex"].ToString() == "1") || (ds.Tables[0].Rows[0]["sex"].ToString().ToLower() == "true"))
                    {
                        model.sex = true;
                    }
                    else
                    {
                        model.sex = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["mobile"] != null && ds.Tables[0].Rows[0]["mobile"].ToString() != "")
                {
                    model.mobile = ds.Tables[0].Rows[0]["mobile"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IDNumber"] != null && ds.Tables[0].Rows[0]["IDNumber"].ToString() != "")
                {
                    model.IDNumber = ds.Tables[0].Rows[0]["IDNumber"].ToString();
                }
                if (ds.Tables[0].Rows[0]["birthDay"] != null && ds.Tables[0].Rows[0]["birthDay"].ToString() != "")
                {
                    model.birthDay = DateTime.Parse(ds.Tables[0].Rows[0]["birthDay"].ToString());
                }
                if (ds.Tables[0].Rows[0]["cardType"] != null && ds.Tables[0].Rows[0]["cardType"].ToString() != "")
                {
                    model.cardType = int.Parse(ds.Tables[0].Rows[0]["cardType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Balance"] != null && ds.Tables[0].Rows[0]["Balance"].ToString() != "")
                {
                    model.Balance = decimal.Parse(ds.Tables[0].Rows[0]["Balance"].ToString());
                }
                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
                {
                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
                }
                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["createDate"] != null && ds.Tables[0].Rows[0]["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["expiresDate"] != null && ds.Tables[0].Rows[0]["expiresDate"].ToString() != "")
                {
                    model.expiresDate = DateTime.Parse(ds.Tables[0].Rows[0]["expiresDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["consume"] != null && ds.Tables[0].Rows[0]["consume"].ToString() != "")
                {
                    model.consume = decimal.Parse(ds.Tables[0].Rows[0]["consume"].ToString());
                }
                if (ds.Tables[0].Rows[0]["memo"] != null && ds.Tables[0].Rows[0]["memo"].ToString() != "")
                {
                    model.memo = ds.Tables[0].Rows[0]["memo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["pwd"] != null && ds.Tables[0].Rows[0]["pwd"].ToString() != "")
                {
                    model.pwd = ds.Tables[0].Rows[0]["pwd"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Marriage"] != null && ds.Tables[0].Rows[0]["Marriage"].ToString() != "")
                {
                    model.Marriage = ds.Tables[0].Rows[0]["Marriage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Zip"] != null && ds.Tables[0].Rows[0]["Zip"].ToString() != "")
                {
                    model.Zip = ds.Tables[0].Rows[0]["Zip"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MemberType"] != null && ds.Tables[0].Rows[0]["MemberType"].ToString() != "")
                {
                    model.MemberType = ds.Tables[0].Rows[0]["MemberType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AreasID"] != null && ds.Tables[0].Rows[0]["AreasID"].ToString() != "")
                {
                    model.AreasID = Convert.ToInt32(ds.Tables[0].Rows[0]["AreasID"]);
                }
                //*****
                if (ds.Tables[0].Rows[0]["Profession"] != null && ds.Tables[0].Rows[0]["Profession"].ToString() != "")
                {
                    model.Profession = ds.Tables[0].Rows[0]["Profession"].ToString();
                }
                if (ds.Tables[0].Rows[0]["hobby"] != null && ds.Tables[0].Rows[0]["hobby"].ToString() != "")
                {
                    model.hobby = ds.Tables[0].Rows[0]["hobby"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Child"] != null && ds.Tables[0].Rows[0]["Child"].ToString() != "")
                {
                    model.Child = ds.Tables[0].Rows[0]["Child"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Unit"] != null && ds.Tables[0].Rows[0]["Unit"].ToString() != "")
                {
                    model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString();
                }
                if (ds.Tables[0].Rows[0]["OpenTeacher"] != null && ds.Tables[0].Rows[0]["OpenTeacher"].ToString() != "")
                {
                    model.OpenTeacher = ds.Tables[0].Rows[0]["OpenTeacher"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetGuaShi(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,memberId,memberCardId,memberName,sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher ");
            strSql.Append(" FROM memberInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 主窗体DGV分页绑定
        /// </summary>
        /// <param name="Size"></param>
        /// <param name="Num"></param>
        /// <returns></returns>
        public DataSet Mains(string Size,string Num,string strWhere,string shaixuan)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top(" + Size + ") id,memberId,memberCardId,memberName,case when sex=1 then '男' else '女' end as sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,case when status=0 then '正常' when status=1 then '挂失' when status=2 then '停用' end as status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher ");
            strSql.Append(" FROM memberInfo where id not in (select  top((" + Num + "-1)*" + Size + ") id from memberInfo order by id)");
            if (strWhere.Trim() != "")
            {
                StringBuilder strSQLwhere = new StringBuilder();
                strSQLwhere.Append("select top(" + Size + ") id,memberId,memberCardId,memberName,case when sex=1 then '男' else '女' end as sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,case when status=0 then '正常' when status=1 then '挂失' when status=2 then '停用' end as status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher ");
                strSQLwhere.Append(" FROM memberInfo where id not in (select  top((" + Num + "-1)*" + Size + ") id from memberInfo where "+strWhere+") and "+strWhere+"");
                if (shaixuan.Trim() != "")
                {
                    StringBuilder strSQLshaixuan = new StringBuilder();
                    strSQLshaixuan.Append("select top(" + Size + ") id,memberId,memberCardId,memberName,case when sex=1 then '男' else '女' end as sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,case when status=0 then '正常' when status=1 then '挂失' when status=2 then '停用' end as status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher ");
                    strSQLshaixuan.Append(" FROM memberInfo where " + shaixuan + " and id not in (select  top((" + Num + "-1)*" + Size + ") id from memberInfo where " + strWhere + ") and " + strWhere + "");
                    return DbHelperSQL.Query(strSQLshaixuan.ToString());
                }
                
                return DbHelperSQL.Query(strSQLwhere.ToString());
            }
            else
            {
                if (shaixuan.Trim() != "")
                {
                    StringBuilder strSQLshaixuan = new StringBuilder();
                    strSQLshaixuan.Append("select top(" + Size + ") id,memberId,memberCardId,memberName,case when sex=1 then '男' else '女' end as sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,case when status=0 then '正常' when status=1 then '挂失' when status=2 then '停用' end as status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher ");
                    strSQLshaixuan.Append(" FROM memberInfo where " + shaixuan + " and id not in (select  top((" + Num + "-1)*" + Size + ") id from memberInfo ");
                    return DbHelperSQL.Query(strSQLshaixuan.ToString());
                }
            return DbHelperSQL.Query(strSql.ToString());
            }
        }

        //public DataSet MainsCardType(string Size, string Num,string strWhere)
        //{
        //    return DbHelperSQL.Query("Main_cardType" + " " + Size + "," + Num+","+strWhere);
        //}


        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,memberId,memberCardId,memberName,case when sex=1 then '男' else '女' end as sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,case when status=0 then '正常' when status=1 then '挂失' when status=2 then '停用' end as status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher ");
            strSql.Append(" FROM memberInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" id,memberId,memberCardId,memberName,sex,mobile,Tel,Email,IDNumber,birthDay,cardType,Balance,point,status,createDate,expiresDate,consume,memo,pwd,Marriage,Zip,Address,AreasID,MemberType,Profession,hobby,QQ,Child,Unit,OpenTeacher  ");
            strSql.Append(" FROM memberInfo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }
        /// <summary>
        /// 获取数据列表
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public List<ZG_member.Model.memberInfo> DataTableToList(DataTable dt)
        {
            List<ZG_member.Model.memberInfo> modelList = new List<ZG_member.Model.memberInfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ZG_member.Model.memberInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZG_member.Model.memberInfo();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["memberId"] != null && dt.Rows[n]["memberId"].ToString() != "")
                    {
                        model.memberId = dt.Rows[n]["memberId"].ToString();
                    }
                    if (dt.Rows[n]["memberCardId"] != null && dt.Rows[n]["memberCardId"].ToString() != "")
                    {
                        model.memberCardId = dt.Rows[n]["memberCardId"].ToString();
                    }
                    if (dt.Rows[n]["memberName"] != null && dt.Rows[n]["memberName"].ToString() != "")
                    {
                        model.memberName = dt.Rows[n]["memberName"].ToString();
                    }
                    if (dt.Rows[n]["sex"] != null && dt.Rows[n]["sex"].ToString() != "")
                    {
                        if ((dt.Rows[n]["sex"].ToString() == "男") || (dt.Rows[n]["sex"].ToString().ToLower() == "true"))
                        {
                            model.sexStr = "男";
                        }
                        else
                        {
                            model.sexStr = "女";
                        }
                    }
                    if (dt.Rows[n]["mobile"] != null && dt.Rows[n]["mobile"].ToString() != "")
                    {
                        model.mobile = dt.Rows[n]["mobile"].ToString();
                    }
                    if (dt.Rows[n]["Tel"] != null && dt.Rows[n]["Tel"].ToString() != "")
                    {
                        model.Tel = dt.Rows[n]["Tel"].ToString();
                    }
                    if (dt.Rows[n]["Email"] != null && dt.Rows[n]["Email"].ToString() != "")
                    {
                        model.Email = dt.Rows[n]["Email"].ToString();
                    }
                    if (dt.Rows[n]["IDNumber"] != null && dt.Rows[n]["IDNumber"].ToString() != "")
                    {
                        model.IDNumber = dt.Rows[n]["IDNumber"].ToString();
                    }
                    if (dt.Rows[n]["birthDay"] != null && dt.Rows[n]["birthDay"].ToString() != "")
                    {
                        model.birthDay = DateTime.Parse(dt.Rows[n]["birthDay"].ToString());
                    }
                    if (dt.Rows[n]["cardType"] != null && dt.Rows[n]["cardType"].ToString() != "")
                    {
                        //model.cardType = int.Parse(dt.Rows[n]["cardType"].ToString());
                        model.cardTypeStr = dt.Rows[n]["cardType"].ToString();
                    }
                    if (dt.Rows[n]["Balance"] != null && dt.Rows[n]["Balance"].ToString() != "")
                    {
                        model.Balance = decimal.Parse(dt.Rows[n]["Balance"].ToString());
                    }
                    if (dt.Rows[n]["point"] != null && dt.Rows[n]["point"].ToString() != "")
                    {
                        model.point = int.Parse(dt.Rows[n]["point"].ToString());
                    }
                    if (dt.Rows[n]["status"] != null && dt.Rows[n]["status"].ToString() != "")
                    {
                        //model.status=int.Parse(dt.Rows[n]["status"].ToString());
                        model.statusStr = dt.Rows[n]["status"].ToString();
                    }
                    if (dt.Rows[n]["createDate"] != null && dt.Rows[n]["createDate"].ToString() != "")
                    {
                        model.createDate = DateTime.Parse(dt.Rows[n]["createDate"].ToString());
                    }
                    if (dt.Rows[n]["expiresDate"] != null && dt.Rows[n]["expiresDate"].ToString() != "")
                    {
                        model.expiresDate = DateTime.Parse(dt.Rows[n]["expiresDate"].ToString());
                    }
                    if (dt.Rows[n]["consume"] != null && dt.Rows[n]["consume"].ToString() != "")
                    {
                        model.consume = decimal.Parse(dt.Rows[n]["consume"].ToString());
                    }
                    if (dt.Rows[n]["memo"] != null && dt.Rows[n]["memo"].ToString() != "")
                    {
                        model.memo = dt.Rows[n]["memo"].ToString();
                    }
                    if (dt.Rows[n]["pwd"] != null && dt.Rows[n]["pwd"].ToString() != "")
                    {
                        model.pwd = dt.Rows[n]["pwd"].ToString();
                    }
                    if (dt.Rows[n]["Marriage"] != null && dt.Rows[n]["Marriage"].ToString() != "")
                    {
                        model.Marriage = dt.Rows[n]["Marriage"].ToString();
                    }
                    if (dt.Rows[n]["Zip"] != null && dt.Rows[n]["Zip"].ToString() != "")
                    {
                        model.Zip = dt.Rows[n]["Zip"].ToString();
                    }
                    if (dt.Rows[n]["Address"] != null && dt.Rows[n]["Address"].ToString() != "")
                    {
                        model.Address = dt.Rows[n]["Address"].ToString();
                    }
                    if (dt.Rows[n]["AreasID"] != null && dt.Rows[n]["AreasID"].ToString() != "")
                    {
                        model.AreasID =Convert.ToInt32(dt.Rows[n]["AreasID"].ToString());
                    }
                    if (dt.Rows[n]["MemberType"] != null && dt.Rows[n]["MemberType"].ToString() != "")
                    {
                        model.MemberType = dt.Rows[n]["MemberType"].ToString();
                    }
                    if (dt.Rows[0]["Profession"] != null && dt.Rows[0]["Profession"].ToString() != "")
                    {
                        model.Profession = dt.Rows[0]["Profession"].ToString();
                    }
                    if (dt.Rows[0]["hobby"] != null && dt.Rows[0]["hobby"].ToString() != "")
                    {
                        model.hobby = dt.Rows[0]["hobby"].ToString();
                    }
                    if (dt.Rows[0]["QQ"] != null && dt.Rows[0]["QQ"].ToString() != "")
                    {
                        model.QQ = dt.Rows[0]["QQ"].ToString();
                    }
                    if (dt.Rows[0]["Child"] != null && dt.Rows[0]["Child"].ToString() != "")
                    {
                        model.Child = dt.Rows[0]["Child"].ToString();
                    }
                    if (dt.Rows[0]["Unit"] != null && dt.Rows[0]["Unit"].ToString() != "")
                    {
                        model.Unit = dt.Rows[0]["Unit"].ToString();
                    }
                    if (dt.Rows[0]["OpenTeacher"] != null && dt.Rows[0]["OpenTeacher"].ToString() != "")
                    {
                        model.OpenTeacher = dt.Rows[0]["OpenTeacher"].ToString();
                    }

                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表Sql
        /// </summary>
        public DataSet GetListSql(string strSql)
        {
            return DbHelperSQL.Query(strSql.ToString());
        }
       
        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "memberInfo";
            parameters[1].Value = "id";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  Method
    }
}

